home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / bbs / mhis020.zip / CALLLIST.MEX < prev    next >
Text File  |  1996-12-09  |  4KB  |  129 lines

  1. #include <max.mh>
  2. #include "wildcard.mh"
  3. #include "general.mh"
  4. #include "findchar.mh"
  5. #include "date.mh"
  6. #include "callers.mh"
  7. #include "callinfo.mh"
  8. #include "callcrit.mh"
  9. #include "callutil.mh"
  10. #include "file.mh"
  11. #include "upchar.mh"
  12.  
  13. #define LEGEND_FILE  "history\\listlgnd"
  14. #define FLAGS_FILE   "history\\flags"
  15. #define HELP_FILE    "history\\listkeys"
  16. #define SPINNER_FILE "history\\spinner"
  17.  
  18. int: more_count;
  19.  
  20. int custom_more () {
  21.   char: key;
  22.   more_count := more_count + 1;
  23.   if (more_count >= usr.len - 1) {
  24.     more_count := 0;
  25.     for (;;) {
  26.       print (COL_LBLUE, "More ", COL_YELLOW, "[Y,n,l,f,?=help]: ");
  27.       while (kbhit ()) getch ();
  28.       show_file (SPINNER_FILE);
  29.       key := getch ();
  30.       print (COL_CYAN, key,'\n');
  31.       key := upChar (key);
  32.  
  33.            if (key = 'N') {return False;}
  34.       else if (key = 'L') {show_file (LEGEND_FILE);}
  35.       else if (key = 'F') {show_file (FLAGS_FILE);}
  36.       else if (key = '?') {show_file (HELP_FILE);}
  37.       else if ((key = 'Y') or (key = '\r')) {return True;}
  38.       else print ("Sorry... unknown command: ", key, '\n');
  39.       };
  40.     };
  41.   return True;
  42.   }
  43.  
  44.  
  45. void show_list () {
  46.   long: calls;
  47.   struct _callinfo: ci;
  48.   int: last_day;
  49.  
  50.   calls := call_numrecs();
  51. //  callers.index := callers.index;
  52.   print(COL_WHITE "Call#  Name                      Node Calls Login Min Up Dn Wr Rd Pg Flags\n"
  53.                   "────── ───────────────────────── ──── ───── ───── ─── ── ── ── ── ── ─────\n");
  54.  
  55. //  callers.index := first_caller_index ();
  56.  
  57.   more_count := 2;
  58.  
  59.   while (   (callers.index >= 0 or (callers.forward_search = True))
  60.         AND (callers.index < calls or (callers.forward_search = False))
  61.         AND call_read(callers.index, ci)
  62.         AND kbhit () = False) {
  63.  
  64.  
  65.     if (meets_criteria (ci, callers.criteria)) {
  66.       if (ci.logoff.date.day <> last_day) {
  67.         print (COL_DKGRAY, strpad ("       " + COL_GRAY +  date_string (ci.logoff.date) + " ",
  68.                usr.width - 1,'─'), '\n');
  69.         if (custom_more () = False) return;
  70.         last_day := ci.logoff.date.day;
  71.         };
  72.       print (COL_WHITE, callers.index);
  73.       while (sys.current_col < 8) {
  74.         print (' ');
  75.         };
  76.       print(COL_LCYAN,    strpad(ci.name,25,' '),
  77.             COL_LMAGENTA, strpadleft(itostr(ci.task),5,' '),
  78.             COL_LRED,     strpadleft(itostr(ci.calls),6,' '), ' ',
  79.             COL_YELLOW,   strpad(time_to_string(ci.login.time),6,' '),
  80.             COL_WHITE,    strpadleft (itostr (time_online (ci) / 60), 3, ' '),
  81.             COL_LCYAN,    strpadleft(itostr (ci.filesup), 3, ' '),
  82.             COL_LBLUE,    strpadleft(itostr (ci.filesdn), 3, ' '), 
  83.             COL_YELLOW,   strpadleft(itostr (ci.posted), 3, ' '),
  84.             COL_LRED,     strpadleft(itostr (ci.read), 3, ' '),
  85.             COL_MAGENTA,  strpadleft(itostr (ci.paged), 3, ' '), ' ',
  86.             COL_LBLUE,    strpad(flag_string (ci.flags), 5, ' '),
  87.             '\n');
  88.       if (custom_more () = False) return;
  89.       }
  90.     else {
  91.       print (COL_WHITE, callers.index);
  92.       print (" \x0d");
  93.       vidsync ();
  94.       };
  95.     if (callers.forward_search) {
  96.       callers.index := callers.index + 1;
  97.       }
  98.     else {
  99.       callers.index := callers.index - 1;
  100.       };
  101.     }
  102.   if (kbhit ()) {
  103.     print (COL_WHITE + "Aborted\n");
  104.     while (kbhit ()) getch ();
  105.     };
  106.   if (callers.index >= calls or callers.index < 0) {
  107.     print (COL_WHITE + "End of callers log\n");
  108.     };
  109.   }
  110.  
  111. void main() {
  112.   string: result;
  113.   read_callers ();
  114.   id.instant_video := 0;
  115.  
  116.   if (call_open()) {
  117.     input_str (result, INPUT_NLB_LINE + INPUT_DEFAULT, 0, 80,
  118.       COL_WHITE + "\nEnter call number, date, '=' for current, or <enter> for first: " + COL_CYAN);
  119.     callers.index := caller_index (result);
  120.     show_list ();
  121.     call_close();
  122.     }
  123.   else {
  124.     print ("Cannot open callers.dat!!\n");
  125.     };
  126.   write_callers ();
  127.   }
  128.  
  129.